// 创建路由实例 让views文件夹的页面能够在app。vue中展示

// 1.0 导入创建方法
import {createRouter,createWebHashHistory,createWebHistory} from 'vue-router';

// 2.0 导入路由(组件)
import Home from '../views/Home.vue';
import Login from '../views/Login.vue';
import Register from '../views/Register.vue';
import Good from '../views/Good.vue';
import Cart from '../views/Cart.vue';

// 3.0 创建路由实例
const router = createRouter({
    history:createWebHashHistory(),
    routes:[
        {
            path:'/',
            redirect: '/home'
        },
        {
            path:'/home',
            component:Home
        },
        {
            path:'/login',
            component: Login
        },
        {
            path:'/register',
            component: Register
        },
        {
            path:'/good/:id',
            component: Good
        },
        {
            path: '/cart',
            component: Cart
        },
        
    ]
})

// 4.0 导出路由
export default router